import React, { useState } from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.tsx'
import RouterIndex from './router.tsx'
import './index.css'

function Main() {
  // const [amount, setAmount] = useState(15);
  // const [refreshKey, setRefreshKey] = useState(0); // 添加一个新的状态

  // const handleAmountChange = (event: React.ChangeEvent<HTMLInputElement>) => {
  //   setAmount(Number(event.target.value));
  // };

  // const handleRefresh = () => { // 添加一个新的函数来改变 refreshKey 的值
  //   setRefreshKey(oldKey => oldKey + 1);
  // };

  return (
    <React.Fragment>
     {/* RouterIndex */}
      {/* <App 
      handleRefresh={handleRefresh}
      handleAmountChange={handleAmountChange} 
      amount={amount} key={refreshKey} 
      />  */}
      <RouterIndex />
      {/* 添加 key prop 来触发组件的重新挂载 */}
    </React.Fragment>
  );
}

ReactDOM.createRoot(document.getElementById('root')!).render(<Main />);